The `$' operator expands scalar variables or constants (double precision numbers from C-calculator mode lookup table) as well as string variables or constants. Existing scalar variables can thus be expanded as a string in order to serve as a file name or directory name, for example. The expansion is done according to the value given to the set vformat command which initially defaults to ``%.3g''. Using the scalar variable expansion operator in C-calculator mode is not recommanded since a lot of precision might be lost (actually it is a waste!). Scalar variable expansion is essentially provided to allow alternative procedures in certain cases, such as generating filenames from numbers. Math function scan can be considered as the complement of scalar variable expansion.
The `$' character also expands string variables. Expansion is done by replacing the $String-Variable-Name by the value of the string variable. This can be used to replace scan in cases where the string variable or constant represents a number. For example
foreach File in echo 2.2 4.4 6.7 8.32 let x = $File . . . end
In both cases, if the variable name has to be followed by alphanumeric characters, then the variable name can be delimited by braces as in standard csh.
Followed by an integer number, the `$' character serves to designate the arguments of a macro. Refer to the description of macro, concerning this point.
$name or ${name}
C, cmode, macro, echo, exit